<?php
/*
This file is part of tribals-bot.

tribals-bot is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

tribals-bot is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with tribals-bot.  If not, see <http://www.gnu.org/licenses/>.
*/
/*
Questo script provvede a fare il login
*/
// Effettuo il primo login sulla pagina principale
$output = curl_download_with_post($first_login_page, $first_login_data);

// Ora estrapolo la password per il secondo login. Essa si trova nella variabile $output insieme ad altro
// I caratteri prima di ciò da estrarre
$str_before_extract = '\/>\n\t<input name=\"password\" type=\"hidden\" value=\"';
// I caratteri dopo ciò da estrarre
$str_after_extract = '\" \/>\n\t<div id=\"active_server\" style=\"overflow:visible; margin-bottom:5px;\">\n';
// Ora estrapolo la password
$extract = str_middle_extract($output, $str_before_extract, $str_after_extract);
// Password per il secondo login
$password_second_login = $extract;

// Ora effettuo il secondo login
$second_login_data = array('user' => $username, 'password' => $password_second_login);
$output = curl_download_with_post($second_login_page, $second_login_data);

?>
